1. Field of the Invention
The present invention relates to a technique for using a plurality of images to correct displacement between the images and combining the images.
2. Description of the Related Art
These days, image-capturing apparatuses such as digital cameras often include various camera shake correction functions in order to prevent blurring of an object image that occurs as a result of movement of the image-capturing apparatus due to camera shake caused by the user at the time of image capturing, or the like. There are two main types of camera shake correction functions, namely, optical camera shake correction and electronic camera shake correction. In electronic camera shake correction, displacement of an object image is corrected through image processing on a plurality of captured images. Specifically, in electronic camera shake correction, the positions of object images having the same pattern are detected in each of a plurality of images that have been obtained by performing image capturing a plurality of times, and the position where the plurality of images are to be combined is adjusted such that the object images having the same pattern mutually overlap.
Such camera shake correction function is effective for image capturing in a dark place such as a night scene, for example. With image capturing in a dark place such as a night scene, a method is employed in which the light-receiving sensitivity of the image sensor is increased in order to achieve proper exposure, although because noise is noticeable in the captured image, another method is also employed in which the exposure time is increased so as to reduce noise and achieve proper exposure. However, as a result of increasing the exposure time, image capturing is susceptible to the effect of camera shake caused by the person who holds the image-capturing apparatus during the exposure time. In such a situation, by using electronic camera shake correction, for example, it becomes possible to reduce noise in a plurality of images captured with a short exposure time and obtain an image in which camera shake has been corrected.
It is desirable to combine images such that the object images having the same pattern in the images mutually overlap when the electronic camera shake correction is performed. However, in the case where the pattern matching is difficult such as, for example, when the amount of camera shake is too large, or when the image is not focused, it is not possible to correctly detect the displacement amount of the object images. That is, it has not been possible for a person to obtain the image that he or she desires, if images for which the displacement amount of the object images has been erroneously detected are combined.
Japanese Patent Laid-Open No. 8-307761 discloses a method in which, in order to avoid not obtaining a desired image as a result of combining images for which the displacement amount of object images has been erroneously detected, only images captured under proper exposure conditions are extracted and combined out of a plurality of captured images. Also, Japanese Patent Laid-Open No. 2000-224470 discloses a method in which since the displacement amount of object images is likely to be large when the exposure time is long, a plurality of images that have been captured during an exposure time that is less than or equal to a predetermined period of time are combined.
In the case where electronic camera shake correction is performed in a bright scene having sufficient illumination, rather than image capturing in a dark place as described above, it is possible to obtain object images having a high edge contrast in each of a plurality of captured images. However, if an image for which the displacement amount of the object image has been erroneously detected is present in the case where the electronic camera shake correction is performed by using these images having a high edge contrast, a so-called double image as shown in FIG. 4A, in which a plurality of object images appear to overlap each other, may occur in the image obtained by combining the images. In particular, in the case where images to be combined are selected and only a small number of images are combined, as in Japanese Patent Laid-Open No. 8-307761, the double image is highly noticeable if it occurs.